<!DOCTYPE html>
<html id="docs" lang="en" class="">
	<head>
	<meta charset="utf-8">
<title>Managing Compute Resources for Containers - Kubernetes</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/png" href="../../../images/favicon.png">
<link rel="stylesheet" type="text/css" href="../../../css/base_fonts.css">
<link rel="stylesheet" type="text/css" href="../../../css/styles.css">
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css">
<link rel="stylesheet" type="text/css" href="../../../css/callouts.css">
<link rel="stylesheet" type="text/css" href="../../../css/custom-jekyll/tags.css">




<meta name="description" content="Managing Compute Resources for Containers" />
<meta property="og:description" content="Managing Compute Resources for Containers" />

<meta property="og:url" content="https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/" />
<meta property="og:title" content="Managing Compute Resources for Containers - Kubernetes" />

<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script
src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
<script src="../../../js/script.js"></script>
<script src="../../../js/custom-jekyll/tags.js"></script>


	</head>
	<body>
		<div id="cellophane" onclick="kub.toggleMenu()"></div>

<header>
    <a href="../../../index.html" class="logo"></a>

    <div class="nav-buttons" data-auto-burger="primary">
        <ul class="global-nav">
            
            
            <li><a href="../../home.1">Documentation</a></li>
            
            <li><a href="../../../blog/index.html">Blog</a></li>
            
            <li><a href="../../../partners/index.html">Partners</a></li>
            
            <li><a href="../../../community/index.html">Community</a></li>
            
            <li><a href="../../../case-studies/index.html">Case Studies</a></li>
            
            
             <li>
                <a href="index.html#">
                    English <span class="ui-icon ui-icon-carat-1-s"></span>
                </a>
                <ul>
                
                    <li><a href="../../../zh/index.html">中文 Chinese</a></li>
                
                    <li><a href="../../../ko/index.html">한국어 Korean</a></li>
                
                </ul>
            </li>
         
            <li>
                <a href="index.html#">
                    v1.11 <span class="ui-icon ui-icon-carat-1-s"></span>
                </a>
                <ul>
                
                    <li><a href="https://kubernetes.io">v1.12</a></li>
                
                    <li><a href="../../../index.html">v1.11</a></li>
                
                    <li><a href="https://v1-10.docs.kubernetes.io">v1.10</a></li>
                
                    <li><a href="https://v1-9.docs.kubernetes.io">v1.9</a></li>
                
                </ul>
            </li>
        </ul>
        
        <a href="../../tutorials/kubernetes-basics/index.html" class="button" id="tryKubernetes" data-auto-burger-exclude>Try Kubernetes</a>
        <button id="hamburger" onclick="kub.toggleMenu()" data-auto-burger-exclude><div></div></button>
    </div>

    <nav id="mainNav">
        <main data-auto-burger="primary">
        <div class="nav-box">
            <h3><a href="../../tutorials/stateless-application/hello-minikube/index.html">Get Started</a></h3>
            <p>Ready to get your hands dirty? Build a simple Kubernetes cluster that runs "Hello World" for Node.js.</p>
        </div>
        <div class="nav-box">
            <h3><a href="../../home.1">Documentation</a></h3>
            <p>Learn how to use Kubernetes with the use of walkthroughs, samples, and reference documentation. You can even <a href="../../../editdocs/index.html" data-auto-burger-exclude>help contribute to the docs</a>!</p>
        </div>
        <div class="nav-box">
            <h3><a href="../../../community/index.html">Community</a></h3>
            <p>If you need help, you can connect with other Kubernetes users and the Kubernetes authors, attend community events, and watch video presentations from around the web.</p>
        </div>
        <div class="nav-box">
            <h3><a href="../../../blog/index.html">Blog</a></h3>
            <p>Read the latest news for Kubernetes and the containers space in general, and get technical how-tos hot off the presses.</p>
        </div>
        </main>
        <main data-auto-burger="primary">
        <div class="left">
            <h5 class="github-invite">Interested in hacking on the core Kubernetes code base?</h5>
            <a href="https://github.com/kubernetes/kubernetes" class="button" data-auto-burger-exclude>View On Github</a>
        </div>

        <div class="right">
            <h5 class="github-invite">Explore the community</h5>
            <div class="social">
                <a href="https://twitter.com/kubernetesio" class="twitter"><span>Twitter</span></a>
                <a href="https://github.com/kubernetes/kubernetes" class="github"><span>Github</span></a>
                <a href="http://slack.k8s.io/" class="slack"><span>Slack</span></a>
                <a href="http://stackoverflow.com/questions/tagged/kubernetes" class="stack-overflow"><span>Stack Overflow</span></a>
                <a href="https://discuss.kubernetes.io" class="mailing-list"><span>Forum</span></a>
                <a href="https://calendar.google.com/calendar/embed?src=nt2tcnbtbied3l6gi2h29slvc0%40group.calendar.google.com" class="calendar"><span>Events Calendar</span></a>
            </div>
        </div>
        <div class="clear" style="clear: both"></div>
        </main>
    </nav>
</header>

		
		
		<section id="hero" class="light-text no-sub">
			









<h1>Concepts</h1>
<h5></h5>








<div id="vendorStrip" class="light-text">
	<ul>
		
		
		<li><a href="../../home.1">DOCUMENTATION</a></li>
		
		
		<li><a href="../../setup/index.html">SETUP</a></li>
		
		
		<li><a href="../../concepts/index.html" class="YAH">CONCEPTS</a></li>
		
		
		<li><a href="../../tasks/index.html">TASKS</a></li>
		
		
		<li><a href="../../tutorials/index.html">TUTORIALS</a></li>
		
		
		<li><a href="../../reference.1">REFERENCE</a></li>
		
	</ul>
	<div id="searchBox">
		<input type="text" id="search" placeholder="Search" onkeydown="if (event.keyCode==13) window.location.replace('/docs/search/?q=' + this.value)" autofocus="autofocus">
	</div>
</div>

		</section>
		
		
<section id="deprecationWarning">
  <main>
    <div class="content deprecation-warning">
      <h3>
        Documentation for Kubernetes v1.11 is no longer actively maintained. The version you are currently viewing is a static snapshot.
        For up-to-date documentation, see the <a href="https://kubernetes.io/docs/home/">latest</a> version.
      </h3>
    </div>
  </main>
</section>


		<section id="encyclopedia">
			
<div id="docsToc">
     <div class="pi-accordion">
    	
        
        
        
        
        
         
             
                 
             
         
             
                 
             
         
             
                 
                          
                          
                 
             
         
             
         
             
         
             
         
             
         
             
         
         
        
        <a class="item" data-title="Concepts" href="../../concepts/index.html"></a>

	
	
		
		
	<div class="item" data-title="Overview">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="What is Kubernetes?" href="../../concepts/overview/index.html"></a>

		
	
		
		
<a class="item" data-title="Kubernetes Components" href="../../concepts/overview/components.1"></a>

		
	
		
		
<a class="item" data-title="The Kubernetes API" href="../../concepts/overview/kubernetes-api/index.html"></a>

		
	
		
		
	<div class="item" data-title="Working with Kubernetes Objects">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Understanding Kubernetes Objects" href="../../concepts/overview/working-with-objects/kubernetes-objects.1"></a>

		
	
		
		
<a class="item" data-title="Names" href="../identifiers"></a>

		
	
		
		
<a class="item" data-title="Namespaces" href="../../concepts/overview/working-with-objects/namespaces.1"></a>

		
	
		
		
<a class="item" data-title="Labels and Selectors" href="../labels"></a>

		
	
		
		
<a class="item" data-title="Annotations" href="../../concepts/overview/working-with-objects/annotations.1"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Object Management Using kubectl">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Kubernetes Object Management" href="../../tutorials/object-management-kubectl/object-management/index.html"></a>

		
	
		
		
<a class="item" data-title="Managing Kubernetes Objects Using Imperative Commands" href="../../tutorials/object-management-kubectl/imperative-object-management-command/index.html"></a>

		
	
		
		
<a class="item" data-title="Imperative Management of Kubernetes Objects Using Configuration Files" href="../../tutorials/object-management-kubectl/imperative-object-management-configuration/index.html"></a>

		
	
		
		
<a class="item" data-title="Declarative Management of Kubernetes Objects Using Configuration Files" href="../../tutorials/object-management-kubectl/declarative-object-management-configuration/index.html"></a>

		
	

		</div>
	</div>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Compute, Storage, and Networking Extensions">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Cluster Administration Overview" href="../../concepts/cluster-administration/cluster-administration-overview/index.html"></a>

		
	
		
		
<a class="item" data-title="Certificates" href="../../concepts/cluster-administration/certificates/index.html"></a>

		
	
		
		
<a class="item" data-title="Cloud Providers" href="../../concepts/cluster-administration/cloud-providers/index.html"></a>

		
	
		
		
<a class="item" data-title="Managing Resources" href="../../concepts/cluster-administration/manage-deployment/index.html"></a>

		
	
		
		
<a class="item" data-title="Cluster Networking" href="../../admin/networking"></a>

		
	
		
		
<a class="item" data-title="Logging Architecture" href="../../concepts/cluster-administration/logging.1"></a>

		
	
		
		
<a class="item" data-title="Configuring kubelet Garbage Collection" href="../../concepts/cluster-administration/kubelet-garbage-collection/index.html"></a>

		
	
		
		
<a class="item" data-title="Federation" href="../../concepts/cluster-administration/federation/index.html"></a>

		
	
		
		
<a class="item" data-title="Proxies in Kubernetes" href="../../concepts/cluster-administration/proxies/index.html"></a>

		
	
		
		
<a class="item" data-title="Controller manager metrics" href="../../concepts/cluster-administration/controller-metrics/index.html"></a>

		
	
		
		
<a class="item" data-title="Installing Addons" href="../../concepts/cluster-administration/addons/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Kubernetes Architecture">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Nodes" href="../../admin/node.1"></a>

		
	
		
		
<a class="item" data-title="Master-Node communication" href="../../concepts/architecture/master-node-communication/index.html"></a>

		
	
		
		
<a class="item" data-title="Concepts Underlying the Cloud Controller Manager" href="../../concepts/architecture/cloud-controller/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Extending Kubernetes">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Extending your Kubernetes Cluster" href="../../concepts/overview/extending/index.html"></a>

		
	
		
		
	<div class="item" data-title="Extending the Kubernetes API">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Extending the Kubernetes API with the aggregation layer" href="../../concepts/api-extension/apiserver-aggregation.1"></a>

		
	
		
		
<a class="item" data-title="Custom Resources" href="../../concepts/api-extension/custom-resources/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Compute, Storage, and Networking Extensions">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Network Plugins" href="../../admin/network-plugins/index.html"></a>

		
	
		
		
<a class="item" data-title="Device Plugins" href="../../concepts/cluster-administration/device-plugins.1"></a>

		
	

		</div>
	</div>

		
	
		
		
<a class="item" data-title="Service Catalog" href="../../concepts/service-catalog/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Containers">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Images" href="../../concepts/containers/images/index.html"></a>

		
	
		
		
<a class="item" data-title="Container Environment Variables" href="../../concepts/containers/container-environment-variables/index.html"></a>

		
	
		
		
<a class="item" data-title="Container Lifecycle Hooks" href="../../concepts/containers/container-lifecycle-hooks/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Workloads">
		<div class="container">
		
		
	
	
		
		
	<div class="item" data-title="Pods">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Pod Overview" href="../../concepts/workloads/pods/pod-overview/index.html"></a>

		
	
		
		
<a class="item" data-title="Pods" href="../pods/index.html"></a>

		
	
		
		
<a class="item" data-title="Pod Lifecycle" href="../pod-states/index.html"></a>

		
	
		
		
<a class="item" data-title="Init Containers" href="../../concepts/abstractions/init-containers/index.html"></a>

		
	
		
		
<a class="item" data-title="Pod Preset" href="../../concepts/workloads/pods/podpreset/index.html"></a>

		
	
		
		
<a class="item" data-title="Disruptions" href="../../concepts/workloads/pods/disruptions/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Controllers">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="ReplicaSet" href="../../concepts/workloads/controllers/replicaset/index.html"></a>

		
	
		
		
<a class="item" data-title="ReplicationController" href="../replication-controller/index.html"></a>

		
	
		
		
<a class="item" data-title="Deployments" href="../../concepts/workloads/controllers/deployment/index.html"></a>

		
	
		
		
<a class="item" data-title="StatefulSets" href="../../concepts/workloads/controllers/statefulset.md"></a>

		
	
		
		
<a class="item" data-title="DaemonSet" href="../../concepts/workloads/controllers/daemonset.1"></a>

		
	
		
		
<a class="item" data-title="Garbage Collection" href="../../concepts/workloads/controllers/garbage-collection/index.html"></a>

		
	
		
		
<a class="item" data-title="Jobs - Run to Completion" href="../../concepts/workloads/controllers/jobs-run-to-completion.1"></a>

		
	
		
		
<a class="item" data-title="CronJob" href="../../concepts/workloads/controllers/cron-jobs.1"></a>

		
	

		</div>
	</div>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Configuration">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Configuration Best Practices" href="../../concepts/configuration/overview/index.html"></a>

		
	
		
		
<a class="item" data-title="Managing Compute Resources for Containers" href="index.html"></a>

		
	
		
		
<a class="item" data-title="Assigning Pods to Nodes" href="../node-selection/index.html"></a>

		
	
		
		
<a class="item" data-title="Taints and Tolerations" href="../../concepts/configuration/taint-and-toleration.1"></a>

		
	
		
		
<a class="item" data-title="Secrets" href="../secrets.1"></a>

		
	
		
		
<a class="item" data-title="Organizing Cluster Access Using kubeconfig Files" href="../../concepts/configuration/organize-cluster-access-kubeconfig/index.html"></a>

		
	
		
		
<a class="item" data-title="Pod Priority and Preemption" href="../../concepts/configuration/pod-priority-preemption/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Services, Load Balancing, and Networking">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Services" href="../services"></a>

		
	
		
		
<a class="item" data-title="DNS for Services and Pods" href="../../concepts/services-networking/dns-pod-service/index.html"></a>

		
	
		
		
<a class="item" data-title="Connecting Applications with Services" href="../../concepts/services-networking/connect-applications-service.1"></a>

		
	
		
		
<a class="item" data-title="Ingress" href="../../concepts/services-networking/ingress/index.html"></a>

		
	
		
		
<a class="item" data-title="Network Policies" href="../../concepts/services-networking/networkpolicies/index.html"></a>

		
	
		
		
<a class="item" data-title="Adding entries to Pod /etc/hosts with HostAliases" href="../../concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Storage">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Volumes" href="../../concepts/storage/volumes.1"></a>

		
	
		
		
<a class="item" data-title="Persistent Volumes" href="../persistent-volumes/index.html"></a>

		
	
		
		
<a class="item" data-title="Storage Classes" href="../../concepts/storage/storage-classes.1"></a>

		
	
		
		
<a class="item" data-title="Dynamic Volume Provisioning" href="../../concepts/storage/dynamic-provisioning/index.html"></a>

		
	
		
		
<a class="item" data-title="Node-specific Volume Limits" href="../../concepts/storage/storage-limits/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Policies">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Resource Quotas" href="../../concepts/policy/resource-quotas/index.html"></a>

		
	
		
		
<a class="item" data-title="Pod Security Policies" href="../pod-security-policy"></a>

		
	

		</div>
	</div>

		
	






     </div> 
    <button class="push-menu-close-button" onclick="kub.toggleToc()"></button>
</div> 

			<div id="docsContent">
				
<p><a href="../../editdocs#docs/concepts/configuration/manage-compute-resources-container.md" id="editPageButton">Edit This Page</a></p>

<h1>Managing Compute Resources for Containers</h1>



<p>When you specify a <a href="../pods/index.html">Pod</a>, you can optionally specify how
much CPU and memory (RAM) each Container needs. When Containers have resource
requests specified, the scheduler can make better decisions about which nodes to
place Pods on. And when Containers have their limits specified, contention for
resources on a node can be handled in a specified manner. For more details about
the difference between requests and limits, see
<a href="https://git.k8s.io/community/contributors/design-proposals/node/resource-qos.md" target="_blank">Resource QoS</a>.</p>









<ul id="markdown-toc">










<li><a href="index.html#resource-types">Resource types</a></li>




<li><a href="index.html#resource-requests-and-limits-of-pod-and-container">Resource requests and limits of Pod and Container</a></li>




<li><a href="index.html#meaning-of-cpu">Meaning of CPU</a></li>




<li><a href="index.html#meaning-of-memory">Meaning of memory</a></li>




<li><a href="index.html#how-pods-with-resource-requests-are-scheduled">How Pods with resource requests are scheduled</a></li>




<li><a href="index.html#how-pods-with-resource-limits-are-run">How Pods with resource limits are run</a></li>




<li><a href="index.html#monitoring-compute-resource-usage">Monitoring compute resource usage</a></li>




<li><a href="index.html#troubleshooting">Troubleshooting</a></li>




<li><a href="index.html#extended-resources">Extended Resources</a></li>




<li><a href="index.html#planned-improvements">Planned Improvements</a></li>




















<li><a href="index.html#what-s-next">What's next</a></li>



</ul>


<h2 id="resource-types">Resource types</h2>

<p><em>CPU</em> and <em>memory</em> are each a <em>resource type</em>. A resource type has a base unit.
CPU is specified in units of cores, and memory is specified in units of bytes.</p>

<p>CPU and memory are collectively referred to as <em>compute resources</em>, or just
<em>resources</em>. Compute
resources are measurable quantities that can be requested, allocated, and
consumed. They are distinct from
<a href="../../concepts/overview/kubernetes-api/index.html">API resources</a>. API resources, such as Pods and
<a href="../services">Services</a> are objects that can be read and modified
through the Kubernetes API server.</p>

<h2 id="resource-requests-and-limits-of-pod-and-container">Resource requests and limits of Pod and Container</h2>

<p>Each Container of a Pod can specify one or more of the following:</p>

<ul>
<li><code>spec.containers[].resources.limits.cpu</code></li>
<li><code>spec.containers[].resources.limits.memory</code></li>
<li><code>spec.containers[].resources.requests.cpu</code></li>
<li><code>spec.containers[].resources.requests.memory</code></li>
</ul>

<p>Although requests and limits can only be specified on individual Containers, it
is convenient to talk about Pod resource requests and limits. A
<em>Pod resource request/limit</em> for a particular resource type is the sum of the
resource requests/limits of that type for each Container in the Pod.</p>

<h2 id="meaning-of-cpu">Meaning of CPU</h2>

<p>Limits and requests for CPU resources are measured in <em>cpu</em> units.
One cpu, in Kubernetes, is equivalent to:</p>

<ul>
<li>1 AWS vCPU</li>
<li>1 GCP Core</li>
<li>1 Azure vCore</li>
<li>1 <em>Hyperthread</em> on a bare-metal Intel processor with Hyperthreading</li>
</ul>

<p>Fractional requests are allowed. A Container with
<code>spec.containers[].resources.requests.cpu</code> of <code>0.5</code> is guaranteed half as much
CPU as one that asks for 1 CPU.  The expression <code>0.1</code> is equivalent to the
expression <code>100m</code>, which can be read as &ldquo;one hundred millicpu&rdquo;. Some people say
&ldquo;one hundred millicores&rdquo;, and this is understood to mean the same thing. A
request with a decimal point, like <code>0.1</code>, is converted to <code>100m</code> by the API, and
precision finer than <code>1m</code> is not allowed. For this reason, the form <code>100m</code> might
be preferred.</p>

<p>CPU is always requested as an absolute quantity, never as a relative quantity;
0.1 is the same amount of CPU on a single-core, dual-core, or 48-core machine.</p>

<h2 id="meaning-of-memory">Meaning of memory</h2>

<p>Limits and requests for <code>memory</code> are measured in bytes. You can express memory as
a plain integer or as a fixed-point integer using one of these suffixes:
E, P, T, G, M, K. You can also use the power-of-two equivalents: Ei, Pi, Ti, Gi,
Mi, Ki. For example, the following represent roughly the same value:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#666">128974848</span>, 129e6, 129M, 123Mi</code></pre></div>
<p>Here&rsquo;s an example.
The following Pod has two Containers. Each Container has a request of 0.25 cpu
and 64MiB (2<sup>26</sup> bytes) of memory. Each Container has a limit of 0.5
cpu and 128MiB of memory. You can say the Pod has a request of 0.5 cpu and 128
MiB of memory, and a limit of 1 cpu and 256MiB of memory.</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>v1<span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>Pod<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>frontend<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>containers:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>db<span style="color:#bbb">
</span><span style="color:#bbb">    </span>image:<span style="color:#bbb"> </span>mysql<span style="color:#bbb">
</span><span style="color:#bbb">    </span>env:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>MYSQL_ROOT_PASSWORD<span style="color:#bbb">
</span><span style="color:#bbb">      </span>value:<span style="color:#bbb"> </span><span style="color:#b44">&#34;password&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>resources:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>requests:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>memory:<span style="color:#bbb"> </span><span style="color:#b44">&#34;64Mi&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">        </span>cpu:<span style="color:#bbb"> </span><span style="color:#b44">&#34;250m&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>limits:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>memory:<span style="color:#bbb"> </span><span style="color:#b44">&#34;128Mi&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">        </span>cpu:<span style="color:#bbb"> </span><span style="color:#b44">&#34;500m&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>wp<span style="color:#bbb">
</span><span style="color:#bbb">    </span>image:<span style="color:#bbb"> </span>wordpress<span style="color:#bbb">
</span><span style="color:#bbb">    </span>resources:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>requests:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>memory:<span style="color:#bbb"> </span><span style="color:#b44">&#34;64Mi&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">        </span>cpu:<span style="color:#bbb"> </span><span style="color:#b44">&#34;250m&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>limits:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>memory:<span style="color:#bbb"> </span><span style="color:#b44">&#34;128Mi&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">        </span>cpu:<span style="color:#bbb"> </span><span style="color:#b44">&#34;500m&#34;</span></code></pre></div>
<h2 id="how-pods-with-resource-requests-are-scheduled">How Pods with resource requests are scheduled</h2>

<p>When you create a Pod, the Kubernetes scheduler selects a node for the Pod to
run on. Each node has a maximum capacity for each of the resource types: the
amount of CPU and memory it can provide for Pods. The scheduler ensures that,
for each resource type, the sum of the resource requests of the scheduled
Containers is less than the capacity of the node. Note that although actual memory
or CPU resource usage on nodes is very low, the scheduler still refuses to place
a Pod on a node if the capacity check fails. This protects against a resource
shortage on a node when resource usage later increases, for example, during a
daily peak in request rate.</p>

<h2 id="how-pods-with-resource-limits-are-run">How Pods with resource limits are run</h2>

<p>When the kubelet starts a Container of a Pod, it passes the CPU and memory limits
to the container runtime.</p>

<p>When using Docker:</p>

<ul>
<li><p>The <code>spec.containers[].resources.requests.cpu</code> is converted to its core value,
which is potentially fractional, and multiplied by 1024. The greater of this number
or 2 is used as the value of the
<a href="https://docs.docker.com/engine/reference/run/#/cpu-share-constraint" target="_blank"><code>--cpu-shares</code></a>
flag in the <code>docker run</code> command.</p></li>

<li><p>The <code>spec.containers[].resources.limits.cpu</code> is converted to its millicore value and
multiplied by 100. The resulting value is the total amount of CPU time that a container can use
every 100ms. A container cannot use more than its share of CPU time during this interval.</p></li>
</ul>

<p><blockquote class="note">
  <div><strong>Note</strong>: The default quota period is 100ms. The minimum resolution of CPU quota is 1ms.{{</div>
</blockquote>
}</p>

<ul>
<li>The <code>spec.containers[].resources.limits.memory</code> is converted to an integer, and
used as the value of the
<a href="https://docs.docker.com/engine/reference/run/#/user-memory-constraints" target="_blank"><code>--memory</code></a>
flag in the <code>docker run</code> command.</li>
</ul>

<p>If a Container exceeds its memory limit, it might be terminated. If it is
restartable, the kubelet will restart it, as with any other type of runtime
failure.</p>

<p>If a Container exceeds its memory request, it is likely that its Pod will
be evicted whenever the node runs out of memory.</p>

<p>A Container might or might not be allowed to exceed its CPU limit for extended
periods of time. However, it will not be killed for excessive CPU usage.</p>

<p>To determine whether a Container cannot be scheduled or is being killed due to
resource limits, see the
<a href="index.html#troubleshooting">Troubleshooting</a> section.</p>

<h2 id="monitoring-compute-resource-usage">Monitoring compute resource usage</h2>

<p>The resource usage of a Pod is reported as part of the Pod status.</p>

<p>If <a href="http://releases.k8s.io/v1.11.3/cluster/addons/cluster-monitoring/README.md" target="_blank">optional monitoring</a>
is configured for your cluster, then Pod resource usage can be retrieved from
the monitoring system.</p>

<h2 id="troubleshooting">Troubleshooting</h2>

<h3 id="my-pods-are-pending-with-event-message-failedscheduling">My Pods are pending with event message failedScheduling</h3>

<p>If the scheduler cannot find any node where a Pod can fit, the Pod remains
unscheduled until a place can be found. An event is produced each time the
scheduler fails to find a place for the Pod, like this:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">$ kubectl describe pod frontend | grep -A <span style="color:#666">3</span> Events
Events:
  FirstSeen LastSeen   Count  From          Subobject   PathReason      Message
  36s   5s     <span style="color:#666">6</span>      <span style="color:#666">{</span>scheduler <span style="color:#666">}</span>              FailedScheduling  Failed <span style="color:#a2f;font-weight:bold">for</span> reason PodExceedsFreeCPU and possibly others</code></pre></div>
<p>In the preceding example, the Pod named &ldquo;frontend&rdquo; fails to be scheduled due to
insufficient CPU resource on the node. Similar error messages can also suggest
failure due to insufficient memory (PodExceedsFreeMemory). In general, if a Pod
is pending with a message of this type, there are several things to try:</p>

<ul>
<li>Add more nodes to the cluster.</li>
<li>Terminate unneeded Pods to make room for pending Pods.</li>
<li>Check that the Pod is not larger than all the nodes. For example, if all the
nodes have a capacity of <code>cpu: 1</code>, then a Pod with a request of <code>cpu: 1.1</code> will
never be scheduled.</li>
</ul>

<p>You can check node capacities and amounts allocated with the
<code>kubectl describe nodes</code> command. For example:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">$ kubectl describe nodes e2e-test-minion-group-4lw4
Name:            e2e-test-minion-group-4lw4
<span style="color:#666">[</span> ... lines removed <span style="color:#a2f;font-weight:bold">for</span> clarity ...<span style="color:#666">]</span>
Capacity:
 cpu:                               <span style="color:#666">2</span>
 memory:                            7679792Ki
 pods:                              <span style="color:#666">110</span>
Allocatable:
 cpu:                               1800m
 memory:                            7474992Ki
 pods:                              <span style="color:#666">110</span>
<span style="color:#666">[</span> ... lines removed <span style="color:#a2f;font-weight:bold">for</span> clarity ...<span style="color:#666">]</span>
Non-terminated Pods:        <span style="color:#666">(</span><span style="color:#666">5</span> in total<span style="color:#666">)</span>
  Namespace    Name                                  CPU Requests  CPU Limits  Memory Requests  Memory Limits
  ---------    ----                                  ------------  ----------  ---------------  -------------
  kube-system  fluentd-gcp-v1.38-28bv1               100m <span style="color:#666">(</span><span style="color:#666">5</span>%<span style="color:#666">)</span>     <span style="color:#666">0</span> <span style="color:#666">(</span><span style="color:#666">0</span>%<span style="color:#666">)</span>      200Mi <span style="color:#666">(</span><span style="color:#666">2</span>%<span style="color:#666">)</span>       200Mi <span style="color:#666">(</span><span style="color:#666">2</span>%<span style="color:#666">)</span>
  kube-system  kube-dns-3297075139-61lj3             260m <span style="color:#666">(</span><span style="color:#666">13</span>%<span style="color:#666">)</span>    <span style="color:#666">0</span> <span style="color:#666">(</span><span style="color:#666">0</span>%<span style="color:#666">)</span>      100Mi <span style="color:#666">(</span><span style="color:#666">1</span>%<span style="color:#666">)</span>       170Mi <span style="color:#666">(</span><span style="color:#666">2</span>%<span style="color:#666">)</span>
  kube-system  kube-proxy-e2e-test-...               100m <span style="color:#666">(</span><span style="color:#666">5</span>%<span style="color:#666">)</span>     <span style="color:#666">0</span> <span style="color:#666">(</span><span style="color:#666">0</span>%<span style="color:#666">)</span>      <span style="color:#666">0</span> <span style="color:#666">(</span><span style="color:#666">0</span>%<span style="color:#666">)</span>           <span style="color:#666">0</span> <span style="color:#666">(</span><span style="color:#666">0</span>%<span style="color:#666">)</span>
  kube-system  monitoring-influxdb-grafana-v4-z1m12  200m <span style="color:#666">(</span><span style="color:#666">10</span>%<span style="color:#666">)</span>    200m <span style="color:#666">(</span><span style="color:#666">10</span>%<span style="color:#666">)</span>  600Mi <span style="color:#666">(</span><span style="color:#666">8</span>%<span style="color:#666">)</span>       600Mi <span style="color:#666">(</span><span style="color:#666">8</span>%<span style="color:#666">)</span>
  kube-system  node-problem-detector-v0.1-fj7m3      20m <span style="color:#666">(</span><span style="color:#666">1</span>%<span style="color:#666">)</span>      200m <span style="color:#666">(</span><span style="color:#666">10</span>%<span style="color:#666">)</span>  20Mi <span style="color:#666">(</span><span style="color:#666">0</span>%<span style="color:#666">)</span>        100Mi <span style="color:#666">(</span><span style="color:#666">1</span>%<span style="color:#666">)</span>
Allocated resources:
  <span style="color:#666">(</span>Total limits may be over <span style="color:#666">100</span> percent, i.e., overcommitted.<span style="color:#666">)</span>
  CPU Requests    CPU Limits    Memory Requests    Memory Limits
  ------------    ----------    ---------------    -------------
  680m <span style="color:#666">(</span><span style="color:#666">34</span>%<span style="color:#666">)</span>      400m <span style="color:#666">(</span><span style="color:#666">20</span>%<span style="color:#666">)</span>    920Mi <span style="color:#666">(</span><span style="color:#666">12</span>%<span style="color:#666">)</span>        1070Mi <span style="color:#666">(</span><span style="color:#666">14</span>%<span style="color:#666">)</span></code></pre></div>
<p>In the preceding output, you can see that if a Pod requests more than 1120m
CPUs or 6.23Gi of memory, it will not fit on the node.</p>

<p>By looking at the <code>Pods</code> section, you can see which Pods are taking up space on
the node.</p>

<p>The amount of resources available to Pods is less than the node capacity, because
system daemons use a portion of the available resources. The <code>allocatable</code> field
<a href="../../reference/generated/kubernetes-api/v1.11/index.html#nodestatus-v1-core">NodeStatus</a>
gives the amount of resources that are available to Pods. For more information, see
<a href="https://git.k8s.io/community/contributors/design-proposals/node/node-allocatable.md" target="_blank">Node Allocatable Resources</a>.</p>

<p>The <a href="../../concepts/policy/resource-quotas/index.html">resource quota</a> feature can be configured
to limit the total amount of resources that can be consumed. If used in conjunction
with namespaces, it can prevent one team from hogging all the resources.</p>

<h3 id="my-container-is-terminated">My Container is terminated</h3>

<p>Your Container might get terminated because it is resource-starved. To check
whether a Container is being killed because it is hitting a resource limit, call
<code>kubectl describe pod</code> on the Pod of interest:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell"><span style="color:#666">[</span><span style="color:#666">12</span>:54:41<span style="color:#666">]</span> $ kubectl describe pod simmemleak-hra99
Name:                           simmemleak-hra99
Namespace:                      default
Image<span style="color:#666">(</span>s<span style="color:#666">)</span>:                       saadali/simmemleak
Node:                           kubernetes-node-tf0f/10.240.216.66
Labels:                         <span style="color:#b8860b">name</span><span style="color:#666">=</span>simmemleak
Status:                         Running
Reason:
Message:
IP:                             <span style="color:#666">10</span>.244.2.75
Replication Controllers:        simmemleak <span style="color:#666">(</span><span style="color:#666">1</span>/1 replicas created<span style="color:#666">)</span>
Containers:
  simmemleak:
    Image:  saadali/simmemleak
    Limits:
      cpu:                      100m
      memory:                   50Mi
    State:                      Running
      Started:                  Tue, <span style="color:#666">07</span> Jul <span style="color:#666">2015</span> <span style="color:#666">12</span>:54:41 -0700
    Last Termination State:     Terminated
      Exit Code:                <span style="color:#666">1</span>
      Started:                  Fri, <span style="color:#666">07</span> Jul <span style="color:#666">2015</span> <span style="color:#666">12</span>:54:30 -0700
      Finished:                 Fri, <span style="color:#666">07</span> Jul <span style="color:#666">2015</span> <span style="color:#666">12</span>:54:33 -0700
    Ready:                      False
    Restart Count:              <span style="color:#666">5</span>
Conditions:
  Type      Status
  Ready     False
Events:
  FirstSeen                         LastSeen                         Count  From                              SubobjectPath                       Reason      Message
  Tue, <span style="color:#666">07</span> Jul <span style="color:#666">2015</span> <span style="color:#666">12</span>:53:51 -0700   Tue, <span style="color:#666">07</span> Jul <span style="color:#666">2015</span> <span style="color:#666">12</span>:53:51 -0700  <span style="color:#666">1</span>      <span style="color:#666">{</span>scheduler <span style="color:#666">}</span>                                                          scheduled   Successfully assigned simmemleak-hra99 to kubernetes-node-tf0f
  Tue, <span style="color:#666">07</span> Jul <span style="color:#666">2015</span> <span style="color:#666">12</span>:53:51 -0700   Tue, <span style="color:#666">07</span> Jul <span style="color:#666">2015</span> <span style="color:#666">12</span>:53:51 -0700  <span style="color:#666">1</span>      <span style="color:#666">{</span>kubelet kubernetes-node-tf0f<span style="color:#666">}</span>    implicitly required container POD   pulled      Pod container image <span style="color:#b44">&#34;k8s.gcr.io/pause:0.8.0&#34;</span> already present on machine
  Tue, <span style="color:#666">07</span> Jul <span style="color:#666">2015</span> <span style="color:#666">12</span>:53:51 -0700   Tue, <span style="color:#666">07</span> Jul <span style="color:#666">2015</span> <span style="color:#666">12</span>:53:51 -0700  <span style="color:#666">1</span>      <span style="color:#666">{</span>kubelet kubernetes-node-tf0f<span style="color:#666">}</span>    implicitly required container POD   created     Created with docker id 6a41280f516d
  Tue, <span style="color:#666">07</span> Jul <span style="color:#666">2015</span> <span style="color:#666">12</span>:53:51 -0700   Tue, <span style="color:#666">07</span> Jul <span style="color:#666">2015</span> <span style="color:#666">12</span>:53:51 -0700  <span style="color:#666">1</span>      <span style="color:#666">{</span>kubelet kubernetes-node-tf0f<span style="color:#666">}</span>    implicitly required container POD   started     Started with docker id 6a41280f516d
  Tue, <span style="color:#666">07</span> Jul <span style="color:#666">2015</span> <span style="color:#666">12</span>:53:51 -0700   Tue, <span style="color:#666">07</span> Jul <span style="color:#666">2015</span> <span style="color:#666">12</span>:53:51 -0700  <span style="color:#666">1</span>      <span style="color:#666">{</span>kubelet kubernetes-node-tf0f<span style="color:#666">}</span>    spec.containers<span style="color:#666">{</span>simmemleak<span style="color:#666">}</span>         created     Created with docker id 87348f12526a</code></pre></div>
<p>In the preceding example, the <code>Restart Count:  5</code> indicates that the <code>simmemleak</code>
Container in the Pod was terminated and restarted five times.</p>

<p>You can call <code>kubectl get pod</code> with the <code>-o go-template=...</code> option to fetch the status
of previously terminated Containers:</p>

<p>```shell{% raw %}
[13:59:01] $ kubectl get pod -o go-template=&lsquo;{{range.status.containerStatuses}}{{&ldquo;Container Name: &ldquo;}}{{.name}}{{&rdquo;\r\nLastState: &ldquo;}}{{.lastState}}{{end}}&rsquo;  simmemleak-hra99
Container Name: simmemleak
LastState: map[terminated:map[exitCode:137 reason:OOM Killed startedAt:2015-07-07T20:58:43Z finishedAt:2015-07-07T20:58:43Z containerID:docker://0e4095bba1feccdfe7ef9fb6ebffe972b4b14285d5acdec6f0d3ae8a22fad8b2]]{% endraw %}</p>

<pre><code>
You can see that the Container was terminated because of `reason:OOM Killed`,
where `OOM` stands for Out Of Memory.

## Local ephemeral storage






&lt;div style=&quot;margin-top: 10px; margin-bottom: 10px;&quot;&gt;



&lt;b&gt;FEATURE STATE:&lt;/b&gt; &lt;code&gt;Kubernetes v1.11&lt;/code&gt;




	
	
	
	
	
&lt;a href=&quot;#&quot; id=&quot;feature-state-dialog-link&quot; class=&quot;ui-state-default ui-corner-all&quot;&gt;&lt;span class=&quot;ui-icon ui-icon-newwin&quot;&gt;&lt;/span&gt;beta&lt;/a&gt;
&lt;div id=&quot;feature-state-dialog&quot; class=&quot;ui-dialog-content&quot; title=&quot;beta&quot;&gt;
This feature is currently in a &lt;em&gt;beta&lt;/em&gt; state, meaning:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The version names contain beta (e.g. v2beta3).&lt;/li&gt;
&lt;li&gt;Code is well tested. Enabling the feature is considered safe. Enabled by default.&lt;/li&gt;
&lt;li&gt;Support for the overall feature will not be dropped, though details may change.&lt;/li&gt;
&lt;li&gt;The schema and/or semantics of objects may change in incompatible ways in a subsequent beta or stable release. When this happens, we will provide instructions for migrating to the next version. This may require deleting, editing, and re-creating API objects. The editing process may require some thought. This may require downtime for applications that rely on the feature.&lt;/li&gt;
&lt;li&gt;Recommended for only non-business-critical uses because of potential for incompatible changes in subsequent releases. If you have multiple clusters that can be upgraded independently, you may be able to relax this restriction.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Please do try our beta features and give feedback on them! After they exit beta, it may not be practical for us to make more changes.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;script&gt;
$(function(){
    
    $( &quot;#feature-state-dialog&quot; ).dialog({
        autoOpen: false,
        width: &quot;600&quot;,
        buttons: [
            {
                text: &quot;Ok&quot;,
                click: function() {
                    $( this ).dialog( &quot;close&quot; );
                }
            }
        ]
    });

    
    $( &quot;#feature-state-dialog-link&quot; ).click(function( event ) {
        $( &quot;#feature-state-dialog&quot; ).dialog( &quot;open&quot; );
        event.preventDefault();
    });

});
&lt;/script&gt;

	

&lt;/div&gt;



Kubernetes version 1.8 introduces a new resource, _ephemeral-storage_ for managing local ephemeral storage. In each Kubernetes node, kubelet's root directory (/var/lib/kubelet by default) and log directory (/var/log) are stored on the root partition of the node. This partition is also shared and consumed by pods via EmptyDir volumes, container logs, image layers and container writable layers.

This partition is “ephemeral” and applications cannot expect any performance SLAs (Disk IOPS for example) from this partition. Local ephemeral storage management only applies for the root partition; the optional partition for image layer and writable layer is out of scope.

&lt;blockquote class=&quot;note&quot;&gt;
  &lt;div&gt;&lt;strong&gt;Note:&lt;/strong&gt; If an optional runtime partition is used, root partition will not hold any image layer or writable layers.&lt;/div&gt;
&lt;/blockquote&gt;


### Requests and limits setting for local ephemeral storage
Each Container of a Pod can specify one or more of the following:

* `spec.containers[].resources.limits.ephemeral-storage`
* `spec.containers[].resources.requests.ephemeral-storage`

Limits and requests for `ephemeral-storage` are measured in bytes. You can express storage as
a plain integer or as a fixed-point integer using one of these suffixes:
E, P, T, G, M, K. You can also use the power-of-two equivalents: Ei, Pi, Ti, Gi,
Mi, Ki. For example, the following represent roughly the same value:

```shell
128974848, 129e6, 129M, 123Mi
</code></pre>

<p>For example, the following Pod has two Containers. Each Container has a request of 2GiB of local ephemeral storage. Each Container has a limit of 4GiB of local ephemeral storage. Therefore, the Pod has a request of 4GiB of local ephemeral storage, and a limit of 8GiB of storage.</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>v1<span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>Pod<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>frontend<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>containers:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>db<span style="color:#bbb">
</span><span style="color:#bbb">    </span>image:<span style="color:#bbb"> </span>mysql<span style="color:#bbb">
</span><span style="color:#bbb">    </span>env:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>MYSQL_ROOT_PASSWORD<span style="color:#bbb">
</span><span style="color:#bbb">      </span>value:<span style="color:#bbb"> </span><span style="color:#b44">&#34;password&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>resources:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>requests:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>ephemeral-storage:<span style="color:#bbb"> </span><span style="color:#b44">&#34;2Gi&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>limits:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>ephemeral-storage:<span style="color:#bbb"> </span><span style="color:#b44">&#34;4Gi&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>wp<span style="color:#bbb">
</span><span style="color:#bbb">    </span>image:<span style="color:#bbb"> </span>wordpress<span style="color:#bbb">
</span><span style="color:#bbb">    </span>resources:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>requests:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>ephemeral-storage:<span style="color:#bbb"> </span><span style="color:#b44">&#34;2Gi&#34;</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>limits:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>ephemeral-storage:<span style="color:#bbb"> </span><span style="color:#b44">&#34;4Gi&#34;</span></code></pre></div>
<h3 id="how-pods-with-ephemeral-storage-requests-are-scheduled">How Pods with ephemeral-storage requests are scheduled</h3>

<p>When you create a Pod, the Kubernetes scheduler selects a node for the Pod to
run on. Each node has a maximum amount of local ephemeral storage it can provide for Pods. (For more information, see <a href="../../tasks/administer-cluster/reserve-compute-resources/index.html#node-allocatable">&ldquo;Node Allocatable&rdquo;</a> The scheduler ensures that the sum of the resource requests of the scheduled Containers is less than the capacity of the node.</p>

<h3 id="how-pods-with-ephemeral-storage-limits-run">How Pods with ephemeral-storage limits run</h3>

<p>For container-level isolation, if a Container&rsquo;s writable layer and logs usage exceeds its storage limit, the pod will be evicted. For pod-level isolation, if the sum of the local ephemeral storage usage from all containers and also the pod&rsquo;s EmptyDir volumes exceeds the limit, the pod will be evicted.</p>

<h2 id="extended-resources">Extended Resources</h2>

<p>Extended Resources are fully-qualified resource names outside the
<code>kubernetes.io</code> domain. They allow cluster operators to advertise and users to
consume the non-Kubernetes-built-in resources.</p>

<p>There are two steps required to use Extended Resources. First, the cluster
operator must advertise an Extended Resource. Second, users must request the
Extended Resource in Pods.</p>

<h3 id="managing-extended-resources">Managing extended resources</h3>

<h4 id="node-level-extended-resources">Node-level extended resources</h4>

<p>Node-level extended resources are tied to nodes.</p>

<h5 id="device-plugin-managed-resources">Device plugin managed resources</h5>

<p>See <a href="../../concepts/cluster-administration/device-plugins.1">Device
Plugin</a>
for how to advertise device plugin managed resources on each node.</p>

<h5 id="other-resources">Other resources</h5>

<p>To advertise a new node-level extended resource, the cluster operator can
submit a <code>PATCH</code> HTTP request to the API server to specify the available
quantity in the <code>status.capacity</code> for a node in the cluster. After this
operation, the node&rsquo;s <code>status.capacity</code> will include a new resource. The
<code>status.allocatable</code> field is updated automatically with the new resource
asynchronously by the kubelet. Note that because the scheduler uses the node
<code>status.allocatable</code> value when evaluating Pod fitness, there may be a short
delay between patching the node capacity with a new resource and the first pod
that requests the resource to be scheduled on that node.</p>

<p><strong>Example:</strong></p>

<p>Here is an example showing how to use <code>curl</code> to form an HTTP request that
advertises five &ldquo;example.com/foo&rdquo; resources on node <code>k8s-node-1</code> whose master
is <code>k8s-master</code>.</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">curl --header <span style="color:#b44">&#34;Content-Type: application/json-patch+json&#34;</span> <span style="color:#b62;font-weight:bold">\
</span><span style="color:#b62;font-weight:bold"></span>--request PATCH <span style="color:#b62;font-weight:bold">\
</span><span style="color:#b62;font-weight:bold"></span>--data <span style="color:#b44">&#39;[{&#34;op&#34;: &#34;add&#34;, &#34;path&#34;: &#34;/status/capacity/example.com~1foo&#34;, &#34;value&#34;: &#34;5&#34;}]&#39;</span> <span style="color:#b62;font-weight:bold">\
</span><span style="color:#b62;font-weight:bold"></span>http://k8s-master:8080/api/v1/nodes/k8s-node-1/status</code></pre></div>
<blockquote class="note">
  <div><strong>Note</strong>: In the preceding request, <code>~1</code> is the encoding for the character <code>/</code>
in the patch path. The operation path value in JSON-Patch is interpreted as a
JSON-Pointer. For more details, see
<a href="https://tools.ietf.org/html/rfc6901#section-3" target="_blank">IETF RFC 6901, section 3</a>.</div>
</blockquote>

<h4 id="cluster-level-extended-resources">Cluster-level extended resources</h4>

<p>Cluster-level extended resources are not tied to nodes. They are usually managed
by scheduler extenders, which handle the resource comsumption, quota and so on.</p>

<p>You can specify the extended resources that are handled by scheduler extenders
in <a href="https://github.com/kubernetes/kubernetes/blob/release-1.10/pkg/scheduler/api/v1/types.go#L31" target="_blank">scheduler policy
configuration</a>.</p>

<p><strong>Example:</strong></p>

<p>The following configuration for a scheduler policy indicates that the
cluster-level extended resource &ldquo;example.com/foo&rdquo; is handled by scheduler
extender.
 - The scheduler sends a pod to the scheduler extender only if the pod requests
   &ldquo;example.com/foo&rdquo;.
 - The <code>ignoredByScheduler</code> field specifies that the scheduler does not check
   the &ldquo;example.com/foo&rdquo; resource in its <code>PodFitsResources</code> predicate.</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-json" data-lang="json">{
  <span style="color:#008000;font-weight:bold">&#34;kind&#34;</span>: <span style="color:#b44">&#34;Policy&#34;</span>,
  <span style="color:#008000;font-weight:bold">&#34;apiVersion&#34;</span>: <span style="color:#b44">&#34;v1&#34;</span>,
  <span style="color:#008000;font-weight:bold">&#34;extenders&#34;</span>: [
    {
      <span style="color:#008000;font-weight:bold">&#34;urlPrefix&#34;</span>:<span style="color:#b44">&#34;&lt;extender-endpoint&gt;&#34;</span>,
      <span style="color:#008000;font-weight:bold">&#34;bindVerb&#34;</span>: <span style="color:#b44">&#34;bind&#34;</span>,
      <span style="color:#008000;font-weight:bold">&#34;managedResources&#34;</span>: [
        {
          <span style="color:#008000;font-weight:bold">&#34;name&#34;</span>: <span style="color:#b44">&#34;example.com/foo&#34;</span>,
          <span style="color:#008000;font-weight:bold">&#34;ignoredByScheduler&#34;</span>: <span style="color:#a2f;font-weight:bold">true</span>
        }
      ]
    }
  ]
}</code></pre></div>
<h3 id="consuming-extended-resources">Consuming extended resources</h3>

<p>Users can consume Extended Resources in Pod specs just like CPU and memory.
The scheduler takes care of the resource accounting so that no more than the
available amount is simultaneously allocated to Pods.</p>

<p>The API server restricts quantities of Extended Resources to whole numbers.
Examples of <em>valid</em> quantities are <code>3</code>, <code>3000m</code> and <code>3Ki</code>. Examples of
<em>invalid</em> quantities are <code>0.5</code> and <code>1500m</code>.</p>

<blockquote class="note">
  <div><strong>Note:</strong> Extended Resources replace Opaque Integer Resources.
Users can use any domain name prefix other than &ldquo;<code>kubernetes.io</code>&rdquo; which is reserved.</div>
</blockquote>

<p>To consume an Extended Resource in a Pod, include the resource name as a key
in the <code>spec.containers[].resources.limits</code> map in the container spec.</p>

<blockquote class="note">
  <div><strong>Note:</strong> Extended resources cannot be overcommitted, so request and limit
must be equal if both are present in a container spec.</div>
</blockquote>

<p>A Pod is scheduled only if all of the resource requests are satisfied, including
CPU, memory and any Extended Resources. The Pod remains in the <code>PENDING</code> state
as long as the resource request cannot be satisfied.</p>

<p><strong>Example:</strong></p>

<p>The Pod below requests 2 CPUs and 1 &ldquo;example.com/foo&rdquo; (an extended resource).</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>v1<span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>Pod<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>my-pod<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>containers:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>my-container<span style="color:#bbb">
</span><span style="color:#bbb">    </span>image:<span style="color:#bbb"> </span>myimage<span style="color:#bbb">
</span><span style="color:#bbb">    </span>resources:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>requests:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>cpu:<span style="color:#bbb"> </span><span style="color:#666">2</span><span style="color:#bbb">
</span><span style="color:#bbb">        </span>example.com/foo:<span style="color:#bbb"> </span><span style="color:#666">1</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>limits:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>example.com/foo:<span style="color:#bbb"> </span><span style="color:#666">1</span></code></pre></div>
<h2 id="planned-improvements">Planned Improvements</h2>

<p>Kubernetes version 1.5 only allows resource quantities to be specified on a
Container. It is planned to improve accounting for resources that are shared by
all Containers in a Pod, such as
<a href="../../concepts/storage/volumes.1#emptydir">emptyDir volumes</a>.</p>

<p>Kubernetes version 1.5 only supports Container requests and limits for CPU and
memory. It is planned to add new resource types, including a node disk space
resource, and a framework for adding custom
<a href="https://github.com/kubernetes/community/blob/v1.11.3/contributors/design-proposals/scheduling/resources.md" target="_blank">resource types</a>.</p>

<p>Kubernetes supports overcommitment of resources by supporting multiple levels of
<a href="http://issue.k8s.io/168" target="_blank">Quality of Service</a>.</p>

<p>In Kubernetes version 1.5, one unit of CPU means different things on different
cloud providers, and on different machine types within the same cloud providers.
For example, on AWS, the capacity of a node is reported in
<a href="http://aws.amazon.com/ec2/faqs/" target="_blank">ECUs</a>, while in GCE it is reported in logical
cores. We plan to revise the definition of the cpu resource to allow for more
consistency across providers and platforms.</p>












<h2 id="what-s-next">What&#39;s next</h2>
<ul>
<li><p>Get hands-on experience <a href="../../tasks/configure-pod-container/assign-cpu-ram-container">assigning Memory resources to containers and pods</a>.</p></li>

<li><p>Get hands-on experience <a href="../../tasks/configure-pod-container/assign-cpu-resource/index.html">assigning CPU resources to containers and pods</a>.</p></li>

<li><p><a href="../../reference/generated/kubernetes-api/v1.11/index.html#container-v1-core">Container</a></p></li>

<li><p><a href="../../reference/generated/kubernetes-api/v1.11/index.html#resourcerequirements-v1-core">ResourceRequirements</a></p></li>
</ul>






				<div class="issue-button-container">
					<p><a href="index.html"><img src="https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/concepts/configuration/manage-compute-resources-container.md?pixel" alt="Analytics" /></a></p>
					
					
					<script type="text/javascript">
					PDRTJS_settings_8345992 = {
					"id" : "8345992",
					"unique_id" : "\/docs\/concepts\/configuration\/manage-compute-resources-container\/",
					"title" : "Managing Compute Resources for Containers",
					"permalink" : "https:\/\/kubernetes.io\/docs\/concepts\/configuration\/manage-compute-resources-container\/"
					};
					(function(d,c,j){if(!document.getElementById(j)){var pd=d.createElement(c),s;pd.id=j;pd.src=('https:'==document.location.protocol)?'https://polldaddy.com/js/rating/rating.js':'http://i0.poll.fm/js/rating/rating.js';s=document.getElementsByTagName(c)[0];s.parentNode.insertBefore(pd,s);}}(document,'script','pd-rating-js'));
					</script>
					<a href="index.html" onclick="window.open('https://github.com/kubernetes/website/issues/new?title=Issue%20with%20' +
					'k8s.io'+window.location.pathname)" class="button issue">Create an Issue</a>
					
					
					
					<a href="../../editdocs#docs/concepts/configuration/manage-compute-resources-container.md" class="button issue">Edit this Page</a>
					
				</div>
			</div>
		</section>
		<footer>
    <main class="light-text">
        <nav>
            
            
            
            <a href="../../home.1">Documentation</a>
            
            <a href="../../../blog/index.html">Blog</a>
            
            <a href="../../../partners/index.html">Partners</a>
            
            <a href="../../../community/index.html">Community</a>
            
            <a href="../../../case-studies/index.html">Case Studies</a>
            
        </nav>
        <div class="social">
            <div>
                <a href="https://twitter.com/kubernetesio" class="twitter"><span>twitter</span></a>
                <a href="https://github.com/kubernetes/kubernetes" class="github"><span>Github</span></a>
                <a href="http://slack.k8s.io/" class="slack"><span>Slack</span></a>
            </div>
            <div>
                <a href="http://stackoverflow.com/questions/tagged/kubernetes" class="stack-overflow"><span>Stack Overflow</span></a>
                <a href="https://discuss.kubernetes.io" class="mailing-list"><span>Forum</span></a>
                <a href="https://calendar.google.com/calendar/embed?src=nt2tcnbtbied3l6gi2h29slvc0%40group.calendar.google.com" class="calendar"><span>Events Calendar</span></a>
            </div>
            <div>
                <a href="../../getting-started-guides/index.html" class="button">Get Kubernetes</a>
                <a href="https://git.k8s.io/community/contributors/guide" class="button">Contribute</a>
            </div>
        </div>
        <div id="miceType" class="center">
            &copy; 2018 The Kubernetes Authors | Documentation Distributed under <a href="https://git.k8s.io/website/LICENSE" class="light-text">CC BY 4.0</a>
        </div>
        <div id="miceType" class="center">
            Copyright &copy; 2018 The Linux Foundation&reg;. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our <a href="https://www.linuxfoundation.org/trademark-usage" class="light-text">Trademark Usage page</a>
        </div>
    </main>
</footer>

		<button class="flyout-button" onclick="kub.toggleToc()"></button>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-36037335-10', 'auto');
ga('send', 'pageview');


(function () {
    window.addEventListener('DOMContentLoaded', init)

        
        function init() {
            window.removeEventListener('DOMContentLoaded', init)
                hideNav()
        }

    function hideNav(toc){
        if (!toc) toc = document.querySelector('#docsToc')
        if (!toc) return
            var container = toc.querySelector('.container')

                
                if (container) {
                    if (container.childElementCount === 0 || toc.querySelectorAll('a.item').length === 1) {
                        toc.style.display = 'none'
                            document.getElementById('docsContent').style.width = '100%'
                    }
                } else {
                    requestAnimationFrame(function () {
                        hideNav(toc)
                    })
                }
    }
})();
</script>



	</body>
</html>